package zy.gongxiang.pucharse.dataobject;

import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * @Auther: zhangy
 * @Date: 2018/9/17 11:01
 * @Description:
 */
@Entity
@Data
@DynamicUpdate  //更新时间
@Table(name = "md_udc", schema = "gxtest")
@IdClass(UdcPK.class)

//实现序列化，后期可通过redis管理
public class Udc implements Serializable {
    @Id
    private String productCode;
    @Id
    private String userdefinedCode;
    private String descriptionOne;
    private String descriptionTwo;
    @Id
    private String detailCode;
    private String detailMessage;
    private String detailDescription;
    private Date createTime;
    private Date updateTime;


    public Udc() {

    }

    //定义表头字段内容
//
//    public Udc getUdcbody() {
//        //Udc udc = new Udc();
//        this.productCode = productCode;
//        this.userdefinedCode = userdefinedCode;
//        this.descriptionOne = descriptionOne;
//        return this;
//    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Udc udc = (Udc) o;
        return Objects.equals(productCode, udc.productCode) &&
                Objects.equals(userdefinedCode, udc.userdefinedCode) &&
                Objects.equals(descriptionOne, udc.descriptionOne) &&
                Objects.equals(descriptionTwo, udc.descriptionTwo) &&
                Objects.equals(detailCode, udc.detailCode) &&
                Objects.equals(detailMessage, udc.detailMessage) &&
                Objects.equals(detailDescription, udc.detailDescription) &&
                Objects.equals(createTime, udc.createTime) &&
                Objects.equals(updateTime, udc.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(productCode, userdefinedCode, descriptionOne, descriptionTwo, detailCode, detailMessage, detailDescription, createTime, updateTime);
    }
}
